package neurons;

import java.util.HashSet;
import java.util.Set;

public class In implements NeuronInterface {

	private Set<ConnectionInterface> outgoingConnexions;

	public In() {
		outgoingConnexions = new HashSet<ConnectionInterface>();
	}

	@Override
	public void sendConnectionTo(NeuronInterface targetNeuron) {
		double rd = Math.random();
		ConnectionInterface newConnection = new Connection(this, targetNeuron,
				rd);
		targetNeuron.acceptConnection(newConnection);
		outgoingConnexions.add(newConnection);
	}

	@Override
	public void propagate(SignalInterface signal) {
		transmit(signal);
	}

	private void transmit(SignalInterface signal) {
		for (ConnectionInterface connection : outgoingConnexions) {
			connection.transmit(signal);
		}
	}

	@Override
	public void acceptConnection(ConnectionInterface newConnection) {
	}

	@Override
	public void adaptCoeff(ResultInterface result) {
	}

}
